package com.thread;

/**
 * 源码演示： start 和 run 的不同
 */
public class ThreadTest {

    private static void attack() {
        System.out.println("Fight!");
        System.out.println("Current Fight Thread is ****: " + Thread.currentThread().getName());
    }

    public static void main(final String[] args) {
        Thread thread = new Thread() {
            @Override
            public void run() {
                attack();
            }
        };
        System.out.println("Current thread is : " + Thread.currentThread().getName());
        // 调用thread.run(); 就只是线程调用run这个方法而已，也就是你上面定义的
        // 调用thread.start() 就会创建一个新的子线程并且启动
        thread.start();
    }
}
